package com.xjtu.chapter02;

/**
 * @author yjq
 * @version 1.0
 * @date 2021/8/6 16:07
 *
 */
//封装类的测试
public class Ex2_BoxingClass {
    public static void main(String[] args) {
        int i = 9;
        Integer iObj = new Integer(i);
        String s = iObj.toString();
        System.out.println(s);

        //读一个字符串，转换为整型
        i= iObj.parseInt("1897");

        //读一个字符串，转换为封装类对象iObj
        iObj=iObj.valueOf("1987");

        int j =15;
        Integer iObj2 = j;//自动封装
        int d = iObj2;//解封装

        Float fObj1 = 10.0F;//自动封装
        Float fObj2 = 20.0F;//自动封装
        float result = fObj1+fObj2;//解封装
    }
}
